import java.util.Comparator;

public class Test {
    public static void main(String[] args) {
        Person person1=new Person("a",1);
        Person person2=new Person("b",2);
        NameCompare nameCompare=new NameCompare();
        int ret=nameCompare.compare(person1, person1);
        System.out.println(ret);
    }
}
class Person implements Comparable{
    String name;

    public Person(String name, int age) {
        this.name = name;
        this.age = age;
    }

    int age;
    @Override
    public int compareTo(Object o) {
        Person tmp=(Person) o;
        return this.age- tmp.age;
    }
}
class NameCompare implements Comparator<Person>{
    @Override
    public int compare(Person person, Person t1) {
        return person.name.compareTo(t1.name);
    }
}